package com.java.test1;

public class Teacher {
	// 属性
	private String teaName;
	private String teaSex;
	private String courseName;
	private int teaAge;

	// 构造方法
	public Teacher(String teaName, String teaSex, String courseName, int teaAge) {
		
		this();
		System.out.println("执行了带有四个参数的构造方式：");
		this.teaName = teaName;
		this.teaSex = teaSex;
		this.courseName = courseName;
		this.teaAge = teaAge;
	}

	/**
	 * 因为有了自定义的构造函数，原有的默认方式取消，需将原有的默认方式显性写出
	 */
	public Teacher() {
		super();
		System.out.println("执行了默认的构造方式：");
	}

	// 行为方法
	/**
	 * 方法重载i]
	 */
	public void doteaching() {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName());
	}

	/**
	 * 方法重载：个数不同
	 * 
	 * @return
	 */
	public void doteaching(int num) {
		System.out.println(this.getTeaName() + "is teaching " + num + "门课程");
	}

	/**
	 * 方法重组：类型不同
	 * 
	 * @return
	 */
	public void doteaching(String where) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + "at" + where);
	}

	/**
	 * 方法重组：顺序不同
	 * 
	 * @return
	 */
	public void doteaching(String where, int num) {
		System.out.println(this.getTeaName() + "is teaching " + num + "门课程" + "at" + where);
	}

	/**
	 * 方法重组：个数不同，类型不同
	 * 
	 * @return
	 */
	public void doteaching(String schoolName, String where) {
		System.out.println(this.getTeaName() + "is teaching " + this.getCourseName() + "at" + where);
	}

	/**
	 * 变长参数
	 * 
	 * @return
	 */
	public void doteaching(String where, String... schoolName) {
		System.out.println("调用了变长参数的方法");
		System.out.println(this.getTeaName() + "is teaching" + this.getCourseName() + "at" + where);
		for (String string : schoolName) {
			System.out.print(string + "");
		}
	}

	/**
	 * 变长参数与数组的区别
	 * 
	 * @return
	 */
	public void doteaching(String where, int num, int stu, String[] school) {
		System.out.println();
		System.out.println("调用了数组的方法：");
		System.out.println(this.getTeaName() + "is studing" + this.getCourseName() + "at" + where);
		for (String string : school) {
			System.out.println(string + "   ");

		}
	}
	// getter,setter方法重组

	public String getTeaName() {
		return teaName;
	}

	public void setTeaName(String teaName) {
		this.teaName = teaName;
	}

	public String getTeaSex() {
		return teaSex;
	}

	public void setTeaSex(String teaSex) {
		this.teaSex = teaSex;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public int getTeaAge() {
		return teaAge;
	}

	public void setTeaAge(int teaAge) {
		this.teaAge = teaAge;
	}

}
